Skip to contentSkip to conversation

Change in openvpn[master]: options_util: Fix conversion warning in atoi_constrained

Openvpn-devel In review flichtenheld (Code Review) 2 participants 7 messages Oct 8, 2025 – Oct 9, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1759942426000.Id08524661aa5bcc5cd42f27a1aacc636e2b2b004@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1261?usp=email

to review the following change.

Change subject: options_util: Fix conversion warning in atoi_constrained
......................................................................

options_util: Fix conversion warning in atoi_constrained

The whole purpose of the function is to make sure
that cast is safe.

Change-Id Id08524661aa5bcc5cd42f27a1aacc636e2b2b004

---
M src/openvpn/options_util.c

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/1261/1

src/openvpn/options_util.c +1 -10
index 8a1c083..eba7d39 100644
@@ -162,11 +162,6 @@
     return (int)i;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 bool
 atoi_constrained(const char *str, int *value, const char *name, int min, int max, msglvl_t msglevel)
 {
@@ -194,14 +189,10 @@
         return false;
     }
 
-    *value = i;
+    *value = (int)i;
     return true;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static const char *updatable_options[] = { "block-ipv6", "block-outside-dns",
                                            "dhcp-option", "dns",
                                            "ifconfig", "ifconfig-ipv6",

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1261?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id08524661aa5bcc5cd42f27a1aacc636e2b2b004
Gerrit-Change-Number: 1261
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1261?usp=email )

Change subject: options_util: Fix conversion warning in atoi_constrained
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1261?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id08524661aa5bcc5cd42f27a1aacc636e2b2b004
Gerrit-Change-Number: 1261
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 08 Oct 2025 17:00:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 options_util: Fix conversion warning in atoi_constrained

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

The whole purpose of the function is to make sure
that cast is safe.

Change-Id Id08524661aa5bcc5cd42f27a1aacc636e2b2b004

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1261
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1261
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/options_util.c +1 -10
index 8a1c083..eba7d39 100644
@@ -162,11 +162,6 @@
     return (int)i;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 bool
 atoi_constrained(const char *str, int *value, const char *name, int min, int max, msglvl_t msglevel)
 {
@@ -194,14 +189,10 @@
         return false;
     }
 
-    *value = i;
+    *value = (int)i;
     return true;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static const char *updatable_options[] = { "block-ipv6", "block-outside-dns",
                                            "dhcp-option", "dns",
                                            "ifconfig", "ifconfig-ipv6",
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: options_util: Fix conversion warning in atoi_constrained

Trivial and definitely save :-) not tested beyond "BB all green".

Your patch has been applied to the master branch.

commit 5ec23295f03bec3e241f65363bcd0f5b0b2afde6

Author: Frank Lichtenheld
Date:   Wed Oct 8 19:01:57 2025 +0200
     options_util: Fix conversion warning in atoi_constrained

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1261
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/search?l=mid&[email protected]...
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw

Re: [Openvpn-devel] [PATCH applied] Re: options_util: Fix conversion warning in atoi_constrained

Hi,

Quoted 7 lines · Gert Doering

Trivial and definitely save :-) not tested beyond "BB all green".

Your patch has been applied to the master branch.

commit 5ec23295f03bec3e241f65363bcd0f5b0b2afde6

Author: Frank Lichtenheld
Date:   Wed Oct 8 19:01:57 2025 +0200

Or not... wrong mail archive URL, corrected, did not adjust the mail.

This is what I will push now:

commit 8fd8c4fa5d6c113925ebf42d47d9e8d3f292309f (HEAD -> master)

Author: Frank Lichtenheld <[email protected]...>
Date:   Wed Oct 8 19:01:57 2025 +0200
    options_util: Fix conversion warning in atoi_constrained
    
    The whole purpose of the function is to make sure
    that cast is safe.
    
    Change-Id: Id08524661aa5bcc5cd42f27a1aacc636e2b2b004
    Signed-off-by: Frank Lichtenheld <[email protected]...>
    Acked-by: Gert Doering <[email protected]...>
    Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1261
    Message-Id: <[email protected]...>
    URL: https://sourceforge.net/p/openvpn/mailman/message/59244107/
    Signed-off-by: Gert Doering <[email protected]...>

(same commit, different URL: in the message -> different ID)

sorry,

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#6 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1261?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: options_util: Fix conversion warning in atoi_constrained
......................................................................

options_util: Fix conversion warning in atoi_constrained

The whole purpose of the function is to make sure
that cast is safe.

Change-Id Id08524661aa5bcc5cd42f27a1aacc636e2b2b004

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1261
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244107/

---
M src/openvpn/options_util.c

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/1261/2

src/openvpn/options_util.c +1 -10
index 8a1c083..eba7d39 100644
@@ -162,11 +162,6 @@
     return (int)i;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 bool
 atoi_constrained(const char *str, int *value, const char *name, int min, int max, msglvl_t msglevel)
 {
@@ -194,14 +189,10 @@
         return false;
     }
 
-    *value = i;
+    *value = (int)i;
     return true;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static const char *updatable_options[] = { "block-ipv6", "block-outside-dns",
                                            "dhcp-option", "dns",
                                            "ifconfig", "ifconfig-ipv6",

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1261?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id08524661aa5bcc5cd42f27a1aacc636e2b2b004
Gerrit-Change-Number: 1261
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#7 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1261?usp=email )

Change subject: options_util: Fix conversion warning in atoi_constrained
......................................................................

options_util: Fix conversion warning in atoi_constrained

The whole purpose of the function is to make sure
that cast is safe.

Change-Id Id08524661aa5bcc5cd42f27a1aacc636e2b2b004

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1261
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244107/

---
M src/openvpn/options_util.c

1 file changed, 1 insertion(+), 10 deletions(-)
src/openvpn/options_util.c +1 -10
index 8a1c083..eba7d39 100644
@@ -162,11 +162,6 @@
     return (int)i;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 bool
 atoi_constrained(const char *str, int *value, const char *name, int min, int max, msglvl_t msglevel)
 {
@@ -194,14 +189,10 @@
         return false;
     }
 
-    *value = i;
+    *value = (int)i;
     return true;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static const char *updatable_options[] = { "block-ipv6", "block-outside-dns",
                                            "dhcp-option", "dns",
                                            "ifconfig", "ifconfig-ipv6",

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1261?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id08524661aa5bcc5cd42f27a1aacc636e2b2b004
Gerrit-Change-Number: 1261
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>